/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 30318
 * Date: 2023-12-12
 * Time: 16:01
 */
abstract class Pet{
    protected String name;
    public Pet(String n){
        name = n;
    }
    public String getName(){
        return name;
    }
    public abstract String move();
    public abstract String speak();
    public String toString(){
        return "My pet " + name;
    }
}

class Dog extends Pet{
    protected int weight;
    public Dog(String s, int weight){
        super(s);
        this.weight = weight;
    }

    public String speak(){
        return "Woof Woof";
    }

    public String move(){
        return "run";
    }

    public int getWeight() {
        return weight;
    }
}

class Cat extends Pet{
    protected int weight;
    public Cat(String s, int weight){
        super(s);
        this.weight = weight;
    }

    public String speak(){
        return "meow meow";
    }

    public String move() {
        return "run";
    }

    public int getWeight() {
        return weight;
    }
}

class PetTest{
    public static void main(String[] args){
        Pet myPet = new Dog("George", 5);
        Dog myDog = new Dog("snoopy", 10);
        Cat myCat = new Cat("Hello Kitty", 2);

        System.out.println(myPet.toString() + "\n" + "Speak: " +
                myPet.speak() +"\n" + "Weight: " + ((Dog)myPet).getWeight() + "\n" + myPet.move() + " " +
                myPet.getName() + "\n");
        System.out.println(myDog.toString() + "\n" + "Speak: " +
                myDog.speak() +"\n" + "Weight: " + myDog.getWeight() + "\n" + myDog.move() + " " + myDog.getName() + "\n");
        System.out.println(myCat.toString() + "\n" + "Speak: " +
                myCat.speak() +"\n" + "Weight: " + myCat.getWeight() + "\n" + myCat.move() + " " + myCat.getName() + "\n");
    }
}